from db import utils
from logger import logger
from sub_events.base_event import BaseEvent

LOGGER = logger.CustomLogger()

class ClearOwnerPass(BaseEvent):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.event_name_zh: str = "清空加分"
        self.event_name_en: str = "Clear Review"

    def execute(self) :
        # utils.update_event_force_pass(self.hook, "Header File Check", "", False)
        owners = utils.get_code_owners(hook=self.hook)
        for owner in owners:
            group = owner.owner_name
            if utils.update_code_owner_pass(self.hook, group, False):
                if group not in self.OCM.owner_config["groups"]:
                    continue
                self.comment += f"@{group} 加分已清空。\n\n"
